<template>
  <div v-if="isCrossSectional" class="componentContainer" v-drag>
    <el-dialog
      title="横断面分析"
      style="width: 100%"
      :modal="false"
      :close-on-click-modal="false"
      :visible.sync="isCrossSectional"
    >
    <template #title>
       <div
        class="custom-header drag-handle"
        style="font-size: 1rem; display: flex"
      >
        <div
          class="bar"
          style="
            width: 5px;
            height: 20px;
            background-color: white;
            margin-right: 10px;
          "
        ></div>
        <span>横断面分析</span>
      </div>
    </template>
     
      <el-table
        :data="tableData"
        border
        v-loading="isLoading"
        element-loading-text="正在加载数据中..."
        style="overflow: auto"
      >
        <el-table-column
          prop="keywords"
          label="关键字"
          width="90"
        ></el-table-column>
        <el-table-column
          prop="type"
          label="管线类型"
          width="200"
        ></el-table-column>
        <el-table-column prop="DIAMETER" label="管径"></el-table-column>
        <el-table-column prop="MATERIAL" label="管材"></el-table-column>
        <el-table-column prop="name" label="埋深" width="100"></el-table-column>
        <el-table-column
          prop="name"
          label="起点埋深"
          width="100"
        ></el-table-column>
        <el-table-column
          prop="address"
          label="终点埋深"
          width="100"
        ></el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      // isLoading: false,
      isCrossSectional: this.dialogVisible, // 初始化为从父组件传来的值
    };
  },
  props: {
    dialogVisible: {
      type: Boolean,
      required: true,
    },
    tableData: {
      type: Array,
      required: [],
    },
    isLoading: {
      type: Boolean,
      required: false,
    },
  },
  watch: {
    // 当父组件的 dialogVisible 变化时，更新 isPipeBrustShow
    dialogVisible(newVal) {
      this.isCrossSectional = newVal;
    },
  },
};
</script>

<style lang="scss" scoped>
.componentContainer {
  position: absolute;
  width: 50rem;
  height: 50rem;
  top: 0;
  left: -20vw;
  pointer-events: none;
}
::v-deep .el-dialog__wrapper {
  position: absolute !important;
  pointer-events: none !important;
}
::v-deep .el-dialog {
  background-color: #285383;
  pointer-events: none !important;
  // pointer-events: auto;
  .el-dialog__header {
    pointer-events: auto;
  }
  .el-dialog__body {
    pointer-events: auto;
  }
  .el-dialog__title {
    color: white;
  }
}
</style>
